<script setup name="asidelist">
defineProps({
  active: {
    type: Boolean,
    default: false,
  },
})

defineEmits(['edit', 'delete'])
</script>

<template>
  <div class="aside-header-content" :class="{ active: active }">
    <span>
      <slot />
    </span>
    <div>
      <el-button text type="primary" size="small" @click="$emit('edit')">
        <el-icon :size="12"><Edit /></el-icon>
      </el-button>
      <span @click.stop="()=>{}">
        <el-popconfirm width="220" title="确认要删除该图库分类？" confirmButtonText="确认" cancelButtonText="取消" @confirm="$emit('delete')">
          <template #reference>
            <el-button text class="px-1" type="primary" size="small">
              <el-icon :size="12"><Close /></el-icon>
            </el-button>
          </template>
        </el-popconfirm>
      </span>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.aside-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px 6px 10px;
  font-size: var(--text-sm);
  color: var(--gray500);
  cursor: pointer;
  span {
    overflow: hidden;
    -o-overflow: ellipsis;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 50px;
  }
  &:hover {
    background: var(--active);
  }
  &.active {
    background: var(--active);
  }
  .el-button {
    margin: 0;
  }
}
@media screen and (max-width: 375px), screen and (max-width: 414px) {
  .aside-header-content {
    padding-left: 4px;
  }
  span {
    max-width: 76px;
  }
  .el-button {
    padding: 3px;
  }
}
</style>
